package com.numericalmethod.algoquant.model.ralph2009.market;

import java.io.Serializable;

/**
 * 
 * Encapsulate the market status in Ralph 2009.
 * 
 * It is a 3 dimension stochastic variables (St, Mt, Xt) tuple representing
 * asset price, momentum, and excess dividend yield at time t. 
 * 
 * @author Paul/Clement/Stephen
 *
 */
public class MarketState implements Cloneable, Serializable {

	private static final long serialVersionUID = -3991537399192036821L;

	// St
	private double assetPrice;
	// Mt
	private double momentum;
	// Xt
	private double excessDividendYield;
	
	public MarketState() {
		
	}
	
	/**
	 * Create the MarketState object.
	 * 
	 * @param assetPrice St in Ralph2009
	 * @param momentum Mt in Ralph2009
	 * @param excessDividendYield Xt in Ralph2009
	 */
	public MarketState(double assetPrice, double momentum, double excessDividendYield) {
		this.assetPrice=assetPrice;
		this.momentum=momentum;
		this.excessDividendYield=excessDividendYield;
	}
	
	public double getAssetPrice() {
		return assetPrice;
	}

	public double getMomentum() {
		return momentum;
	}

	public double getExcessDividendYield() {
		return excessDividendYield;
	}
	
	@Override
	public Object clone() {
		try {
			return super.clone();
		} catch (CloneNotSupportedException e1) {
			// never
			return null;
		}
	}
	
	@Override
	public String toString() {
		StringBuilder buf=new StringBuilder(50);
		buf.append("MarketState { ");
		buf.append(getAssetPrice());
		buf.append(", ");
		buf.append(getMomentum());
		buf.append(", ");
		buf.append(getExcessDividendYield());
		buf.append(" }");
		return buf.toString();
	}
	
}
